local more1__chouti = fk.CreateSkill {
  name = "more1__chouti",
    tags = { Skill.Quest },
}

Fk:loadTranslationTable{
  ["more1__chouti"] = "抽梯",
  [":more1__chouti"] = "使命技，你不能使用锦囊牌且锦囊牌不计入手牌上限。"..
  "<br>成功：你使用【问计】积累6张牌时，你加两点体力上限并回复至体力上限且将势力修改为蜀然后获得【继荆】和【镇江】。"..
  "<br>失败，你的判定区牌数大于两张时，你弃置所有基本牌并清除【问计】所有记录。加一点体力上限获得【守夏】和【屯江】然后修改【问计】。",

  ["$more1__chouti1"] = "",
  ["$more1__chouti2"] = "",
}


more1__chouti:addEffect(fk.AfterCardsMove, {

  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(more1__chouti.name) and (player:getMark("@more1__wenji-card") >= 6 or #player:getCardIds("j") > 2) and player:usedEffectTimes(self.name, Player.HistoryGame) == 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:invalidateSkill(player, more1__chouti.name)
    if player:getMark("@more1__wenji-card") >= 6 then
      room:updateQuestSkillState(player, more1__chouti.name, false)
      room:changeMaxHp(player, 2)
      if not player.dead and player:isWounded() then
        room:recover { num = player.maxHp-player.hp, skillName = more1__chouti.name, who = player, recoverBy = player}
      end
      room:changeKingdom(player, "shu", true)
      room:handleAddLoseSkills(player, "more1__jijin|more1__zhenjiang", nil, true, false)
    elseif #player:getCardIds("j") > 2 then 
      room:updateQuestSkillState(player, more1__chouti.name, true)
      room:setPlayerMark(player, "@$more1__wenji", 0)
      local cards = table.filter(player:getCardIds("he"), function(id)
        return Fk:getCardById(id).type == Card.TypeBasic
      end)
      if #cards > 0 then
        room:throwCard(cards, more1__chouti.name, player, player)
      end
      room:changeMaxHp(player, 1)
      room:handleAddLoseSkills(player, "more1__shouxia|more1__tunjiang", nil, true, false)
      room:setPlayerMark(player,"more1__chouti",1)
      room:setPlayerMark(player,"@more1__wenji-card",0)
      room:setPlayerMark(player,"@more1__wenji-type",0)
    end
  end,
})

more1__chouti:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    return player:hasSkill(more1__chouti.name) and card.type == Card.TypeTrick
  end,
})

more1__chouti:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return player:hasSkill(more1__chouti.name) and card.type == Card.TypeTrick
  end,
})

return more1__chouti
